#pragma once

#ifndef PSEUDOCODE
#define PSEUDOCODE

enum class BranchType {
	BranchType_DIRCALL, // Direct Branch with link
	BranchType_INDCALL, // Indirect Branch with link
	BranchType_ERET, // Exception return (indirect)
	BranchType_DBGEXIT, // Exit from Debug state
	BranchType_RET, // Indirect branch with function return hint
	BranchType_DIR, // Direct branch
	BranchType_INDIR, // Indirect branch
	BranchType_EXCEPTION, // Exception entry
	BranchType_TMFAIL, // Transaction failure
	BranchType_RESET, // Reset
	BranchType_UNKNOWN
}; // Other
enum class WFxType { WFxType_WFE, WFxType_WFI, WFxType_WFET, WFxType_WFIT };

enum class MemOp { MemOp_LOAD, MemOp_STORE, MemOp_PREFETCH };

enum class SecurityState {
	SS_NonSecure,
	SS_Root,
	SS_Realm,
	SS_Secure
};

enum class AccessType {
	AccessType_IFETCH, // Instruction FETCH
	AccessType_GPR, // Software load/store to a General Purpose Register
	AccessType_ASIMD, // Software ASIMD extension load/store instructions
	AccessType_SVE, // Software SVE load/store instructions
	AccessType_SME, // Software SME load/store instructions
	AccessType_IC, // Sysop IC
	AccessType_DC, // Sysop DC (not DC {Z,G,GZ}VA)
	AccessType_DCZero, // Sysop DC {Z,G,GZ}VA
	AccessType_AT, // Sysop AT
	AccessType_NV2, // NV2 memory redirected access
	AccessType_SPE, // Statistical Profiling buffer access
	AccessType_GCS, // Guarded Control Stack access
	AccessType_TRBE, // Trace Buffer access
	AccessType_GPTW, // Granule Protection Table Walk
	AccessType_TTW // Translation Table Walk
};

enum class MemAtomicOp {
	MemAtomicOp_GCSSS1,
	MemAtomicOp_ADD,
	MemAtomicOp_BIC,
	MemAtomicOp_EOR,
	MemAtomicOp_ORR,
	MemAtomicOp_SMAX,
	MemAtomicOp_SMIN,
	MemAtomicOp_UMAX,
	MemAtomicOp_UMIN,
	MemAtomicOp_SWP,
	MemAtomicOp_CAS
};

enum class CacheOp {
	CacheOp_Clean,
	CacheOp_Invalidate,
	CacheOp_CleanInvalidate
};

enum class CacheOpScope {
	CacheOpScope_SetWay,
	CacheOpScope_PoU,
	CacheOpScope_PoC,
	CacheOpScope_PoE,
	CacheOpScope_PoP,
	CacheOpScope_PoDP,
	CacheOpScope_PoPA,
	CacheOpScope_ALLU,
	CacheOpScope_ALLUIS
};

enum class CacheType {
	CacheType_Data,
	CacheType_Tag,
	CacheType_Data_Tag,
	CacheType_Instruction
};

enum class VARange {
	VARange_LOWER,
	VARange_UPPER
};

enum class PARTIDspaceType {
	PIdSpace_Secure,
	PIdSpace_Root,
	PIdSpace_Realm,
	PIdSpace_NonSecure
};

enum class Regime {
	Regime_EL3, // EL3
	Regime_EL30, // EL3&0 (PL1&0 when EL3 is AArch32)
	Regime_EL2, // EL2
	Regime_EL20, // EL2&0
	Regime_EL10 // EL1&0
};

enum class M32Mode {
	M32_User = 0b10000,
	M32_FIQ = 0b10001,
	M32_IRQ = 0b10010,
	M32_Svc = 0b10011,
	M32_Monitor = 0b10110,
	M32_Abort = 0b10111,
	M32_Hyp = 0b11010,
	M32_Undef = 0b11011,
	M32_System = 0b11111
};

enum class PASpace {
	PAS_NonSecure,
	PAS_Secure,
	PAS_Root,
	PAS_Realm
};

enum class MemType { MemType_Normal, MemType_Device };

enum class MemTagType {
	MemTag_Untagged,
	MemTag_AllocationTagged,
	MemTag_CanonicallyTagged
};

enum class DeviceType { DeviceType_GRE, DeviceType_nGRE, DeviceType_nGnRE, DeviceType_nGnRnE };

enum class Shareability {
	Shareability_NSH,
	Shareability_ISH,
	Shareability_OSH
};

enum class  ErrorState {
	ErrorState_UC, // Uncontainable
	ErrorState_UEU, // Unrecoverable state
	ErrorState_UEO, // Restartable state
	ErrorState_UER, // Recoverable state
	ErrorState_CE, // Corrected
	ErrorState_Uncategorized,
	ErrorState_IMPDEF
};

enum class Fault {
	Fault_None,
	Fault_AccessFlag,
	Fault_Alignment,
	Fault_Background,
	Fault_Domain,
	Fault_Permission,
	Fault_Translation,
	Fault_AddressSize,
	Fault_SyncExternal,
	Fault_SyncExternalOnWalk,
	Fault_SyncParity,
	Fault_SyncParityOnWalk,
	Fault_GPCFOnWalk,
	Fault_GPCFOnOutput,
	Fault_AsyncParity,
	Fault_AsyncExternal,
	Fault_TagCheck,
	Fault_Debug,
	Fault_TLBConflict,
	Fault_BranchTarget,
	Fault_HWUpdateAccessFlag,
	Fault_Lockdown,
	Fault_Exclusive,
	Fault_ICacheMaint
};

enum class GPCF {
	GPCF_None, // No fault
	GPCF_AddressSize, // GPT address size fault
	GPCF_Walk, // GPT walk fault
	GPCF_EABT, // Synchronous External abort on GPT fetch
	GPCF_Fail // Granule protection fault
};

enum class TGx {
	TGx_4KB,
	TGx_16KB,
	TGx_64KB
};
#endif // !PSEUDOCODE
